#include <bits/stdc++.h>

#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
const int INF = 1e9;
using namespace std;
/*思考区
第一个字母肯定是首字母
获取空格后的字母
*/
void solve() {
    string init;
    getline(cin, init);
    string ans(3,0);
    ans[0] = init[0];
    int k = 1;
    for (int i = 0; i < init.length()-1; i++) {
        if (init[i] == ' ') {
            ans[k++] = init[i + 1];
        }
        if (k == 3)break;
    }
    for (int i = 0; i < 3; i++) {
        cout << ans[i];
    }
    cout << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 0;
    cin >> t;
    cin.get();
    while(t--)
    solve();
    return 0;
}